package edu.njust.dao;

import edu.njust.domain.Commodity;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;

import java.util.List;

@Mapper
public interface CommodityMapper {
    //根据id删除
    public int deleteById(int id);

    //插入商品
    public int insertCommodity(Commodity commodity);
    //选择商品
    public	Commodity selectById(int id);
    //更新商品
    public int updateById(Commodity commodity);
    //分页模糊查询
    public List<Commodity> pageSelect(@Param("commodityName")String commodityName,
                                      @Param("commodityTypeID")int commodityTypeID,
                                      @Param("start")int start,
                                      @Param("pageSize")int pageSize);
    //分页模糊查询总条数
    public int countSelect(@Param("commodityName")String commodityName,
                           @Param("commodityTypeID")int commodityTypeID);
    //ajax 验证是否存在 此商品
    public int selectYZ(String commodityName);
}
